<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="utf-8">
    <!--[if IE]>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <![endif]-->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Page title -->
    <title>Petz - Pet HTML5 Template</title>
    <!--[if lt IE 9]>
    <script src="${pageContext.request.contextPath}/foreground/js/respond.js"></script>
    <![endif]-->
    <!-- Bootstrap Core CSS -->
    <link href="${pageContext.request.contextPath}/foreground/css/bootstrap.css" rel="stylesheet" type="text/css">
    <!-- Icon fonts -->
    <link href="${pageContext.request.contextPath}/foreground/fonts/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/foreground/fonts/flaticons/flaticon.css" rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/foreground/fonts/glyphicons/bootstrap-glyphicons.css" rel="stylesheet" type="text/css">
    <!-- Google fonts -->
    <link href="https://fonts.googleapis.com/css?family=Lato:400,800" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Baloo+Thambi" rel="stylesheet">
    <!-- Style CSS -->
    <link href="${pageContext.request.contextPath}/foreground/css/style.css" rel="stylesheet">
    <!-- Plugins CSS -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/foreground/css/plugins.css">
    <!-- Color Style CSS -->
    <link href="${pageContext.request.contextPath}/foreground/styles/maincolors.css" rel="stylesheet">

    <script src="${pageContext.request.contextPath}/background/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/background/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/background/js/xadmin.js"></script>


</head>
<body>
<%--导航栏--%>
<%@ include file="../common/topbar.jsp" %>


<section id="testimonials" class="pages">
    <div class="jumbotron" data-stellar-background-ratio="0.5">
        <div class="jumbo-heading" data-stellar-background-ratio="1.2">
            <h1>捐助</h1>
        </div>
    </div>

    <div class="container">
        <div class="section-heading text-center">
            <h2>朋友，感谢您的帮助！</h2>
        </div>
        <div class="row">
            <div class="col-md-6 col-lg-7 text-center">
                <div class="container">
                    <div class="row">
                        <div class="col-lg-5 col-md-6 col-lg-offset-1 col-md-offset-1 res-margin">
                            <!-- Form Starts -->
                            <form id="contact_form" onsubmit="return false" action="##">
                                <div class="form-group">
                                    <label>用户名<span class="required">*</span></label>
                                    <input type="text" value="${username}" class="form-control input-field" readonly=“readonly”>
                                    <label>捐助类别<span class="required">*</span></label>
                                    <input type="text"  value="${dnType}" class="form-control input-field" readonly=“readonly”>
                                    <label>捐助物品名/服务名<span class="required">*</span></label>
                                    <input type="text" name="dnName" class="form-control input-field" required="">
                                    <label>捐助数量<span class="required">*</span></label>
                                    <input type="text" name="dnNum" class="form-control input-field" required="">
                                    <label>捐助时间<span class="required">*</span></label>
                                    <input type="datetime-local" name="dnDate" class="form-control input-field" required>
                                </div>
                                <button type="submit" id="submit_btn" onclick="addDonation()" value="Submit" class="btn center-block">捐助</button>
                            </form>
                            <div id="contact_results"></div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 右边的图片内容 -->
            <!-- 小狗蓝色碗的图片 -->
            <div class="parallax-object1 hidden-sm hidden-xs"  data-100-start="right: 0%;"
                 data-center-bottom="right:30%;"  >
                <img src="${pageContext.request.contextPath}/foreground/img/illustrations/petbowl.png" alt="">
            </div>
            <!-- 小狗图片 -->
            <div class="col-md-6 col-lg-5" >
                <img src="${pageContext.request.contextPath}/foreground/img/about-index.png" class="img-responsive" alt="">
            </div>
        </div>

    </div>

</section>


<script>
    function addDonation(){
        //发异步删除数据
        $.ajax({
            url:"addDonation",
            data:$('#contact_form').serialize(),//servlet按照"classobj_id"取值
            type:"POST",
            success:function(s){//从servlet获取返回数据data:{SUCCESS ERREO}
                if(s=="SUCCESS"){
                    layer.msg('提交成功!',{icon:1,time:1000});
                }else{
                    layer.alert(s,{title:"提交失败"});
                }
            }
        });
    }
</script>
</body>
</html>
